import { request } from "@/utils/service"
import type * as Pages from "./types"

/** 增 */
export function createPagesApi(data: Pages.CreateOrUpdatePagesRequestData) {
  return request({
    url: "pages",
    method: "post",
    data
  })
}

/** 删 */
export function deletePagesApi(id: string) {
  return request({
    url: `pages/${id}`,
    method: "delete"
  })
}

/** 改 */
export function updatePagesApi(data: Pages.CreateOrUpdatePagesRequestData) {
  return request({
    url: "pages/" + data.id,
    method: "put",
    data
  })
}

/** 查 */
export function getPagesApi(params: Pages.GetPagesRequestData) {
  return request<Pages.GetPagesResponseData>({
    url: "pages",
    method: "get",
    params
  })
}

/** 查详情 */
export function getPagesDetailApi(id: string) {
  return request<Pages.GetNewResponeseDetailData>({
    url: `pages/${id}`,
    method: "get"
  })
}
